package com.bjtech.dao.ibatis;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;
import org.ssi.dao.impl.BaseDaoSqlMapImpl;

import com.bjtech.dao.BaseShareAreaInfoDao;
import com.bjtech.domain.BaseShareAreaInfo;

/**
 * @author wf
 *
 */
@Repository(value="baseShareAreaInfoDao")
public class SqlMapBaseShareAreaInfoDao extends BaseDaoSqlMapImpl<BaseShareAreaInfo> implements
		BaseShareAreaInfoDao {

	public List selectShareAreaListByProjId(Long projId) {
		return super.getSqlMapClientTemplate().queryForList("selectShareAreaListByProjId", projId);
	}

	public void deleteShareAreaLinkedObjs(Long id) {
		super.getSqlMapClientTemplate().delete("deleteAssignMeterByAreaId",id);
		super.getSqlMapClientTemplate().delete("deleteSinkInfoByAreaId",id);
		super.getSqlMapClientTemplate().delete("deleteRoomInfoByAreaId",id);
		super.getSqlMapClientTemplate().delete("deleteBuildingInfoByAreaId",id);
	}

	public Map selectTjParmForShareArea(Long areaId) {
		Map tjParam = new HashMap();
		
		//建筑总面积
		BigDecimal areaSturctArea = (BigDecimal) super.getSqlMapClientTemplate().queryForObject("selectAreaStructAreaYjInfo",areaId);
		tjParam.put("areaSturctArea", areaSturctArea);
		//使用总面积
		BigDecimal areaUseArea = (BigDecimal) super.getSqlMapClientTemplate().queryForObject("selecAreaUseAreaYjInfo",areaId);
		tjParam.put("areaUseArea", areaUseArea);
		//分配表总数
		Long assignMeterNum = (Long) super.getSqlMapClientTemplate().queryForObject("selectAreaAssignMeterNumYjInfo",areaId);
		tjParam.put("assignMeterNum", assignMeterNum);
		//户数
		Long houseNum = (Long) super.getSqlMapClientTemplate().queryForObject("selectAreaHouseNumYjInfo",areaId);
		tjParam.put("houseNum", houseNum);
		//热量表数
		Long heatMeterNum = (Long) super.getSqlMapClientTemplate().queryForObject("selectAreaHeatMeterNumYjInfo",areaId);
		tjParam.put("heatMeterNum", heatMeterNum);
		//热量表号
		String heatMeterNo = (String) super.getSqlMapClientTemplate().queryForObject("selectAreaHeatMeterNoYjInfo",areaId);
		tjParam.put("heatMeterNo", heatMeterNo);
		
		
		return tjParam;
	}

}
